/*
 * @Author: 李环玉 834654733@qq.com
 * @Date: 2023-12-21 22:22:51
 * @LastEditors: 李环玉 834654733@qq.com
 * @LastEditTime: 2023-12-24 00:30:25
 * @FilePath: \vue3-ts-vite\src\main.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { createApp } from 'vue'
import './assets/style/reset.css'
import './assets/scss/reset.scss'
import App from './App.vue'
import langs from '@/utils/globalVariable'
//引入vuex
import store from '@/store/index'
//引入路由
import router from '@/router'
//引入echart
import * as echarts from "echarts"
//路由权限控制
import './permission'
//引入element
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
// 因element-plus默认是英文，我们指定一下默认中文
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
import "@/styles/index.scss";
import 'uno.css'
//引入vxe-table
import VXETable from 'vxe-table'
// import 'vxe-table/lib/style.css'
//重写vxe-table样式
import VXETablePluginElement from 'vxe-table-plugin-element'
import 'vxe-table-plugin-element/dist/style.css'
import '@/assets/styles/index.scss'

// If you want to use ElMessage, import it.
import "element-plus/theme-chalk/src/message.scss"
//引入mock
// import './mock/index.ts'
//引入md编辑器
import VueMarkdownEditor from '@/utils/v-md-editor/edit'
//引入md浏览器
import VMdPreviewHtml from "@/utils/v-md-editor/view"

import Fragment from 'vue-fragment'
// 如果您正在使用CDN引入，请删除下面一行。
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import DataVVue3 from '@kjgl77/datav-vue3'


//引入国际化
import i18n from './lang'
const app = createApp(App)
function useTable (app:any) {
  app.use(VXETable)
  // 给 vue 实例挂载内部对象，例如：
  // app.config.globalProperties.$XModal = VXETable.modal
  // app.config.globalProperties.$XPrint = VXETable.print
  // app.config.globalProperties.$XSaveFile = VXETable.saveFile
  // app.config.globalProperties.$XReadFile = VXETable.readFile
}
app.use(Fragment.Plugin)
VXETable.use(VXETablePluginElement)

//注册md编辑器
app.use(VueMarkdownEditor);
//注册md浏览器
app.use(VMdPreviewHtml)
// 屏蔽警告信息
app.config.warnHandler = () => null;
//挂载echart
app.config.globalProperties.$echarts = echarts
//注册vuex
app.use(store)
//注册路由
app.use(router)

// 注册ElementPlus
app.use(ElementPlus, {
  locale: zhCn, // 语言设置
})
//注册vxe-table

app.use(useTable)
//注册dataV
app.use(DataVVue3)

app.provide('langs',langs)
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}
//注册国际化
app.use(i18n)
app.mount('#app')
